package com.hx.login.config;


import com.hx.login.interceptor.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author wonghiu
 * @Date 2021/6/5 10:32
 * @Version 1.0.1
 */
@Configuration
public class WebAppConfig implements WebMvcConfigurer
{
    @Autowired
    private AuthInterceptor authInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
        //注册自己的拦截器并设置拦截的请求路径
        registry.addInterceptor(authInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/login/**");

    }
}